package com.baosight.risk.web.rire;

import com.baosight.risk.api.rire.RiwaRiskWaringService;
import com.baosight.risk.base.controller.BaseController;
import com.baosight.risk.common.annotation.Log;
import com.baosight.risk.common.result.AjaxResult;
import com.baosight.risk.common.utils.StringUtils;
import com.baosight.risk.service.riim.entity.RiimRiskImport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.ws.rs.core.MediaType;

@Slf4j
@RestController
@RequestMapping("/rire/import/trport")
@Api(value = "披露报告==预警模型", description = "披露报告==预警模型", produces = MediaType.APPLICATION_JSON)
public class RiwaRiskWaringController extends BaseController {

    @Autowired
    private RiwaRiskWaringService waringService;

    /**
     * 普通模型计算
     *
     * @param reportId 披露报告ID
     * @return
     */
    @GetMapping("/generalModel")
    @Log(title = "披露报告==普通模型计算")
    @ApiOperation("披露报告==普通模型计算")
    public AjaxResult generalModel(String reportId) throws Exception {
        if (StringUtils.isEmpty(reportId)) {
            log.error("数据为空！");
            return error("数据为空！");
        }
        return success(waringService.generalModelCalculate(reportId));
    }

}